-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Fixed Categorical.Equals with unordered #18822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: Fixed Categorical.Equals with unordered #18822
Conversation
Codecov Report
@@ Coverage Diff @@
## master #18822 +/- ##
==========================================
- Coverage 91.56% 91.56% -0.01%
==========================================
Files 150 150
Lines 48942 48947 +5
==========================================
+ Hits 44816 44820 +4
- Misses 4126 4127 +1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small code comment.
pandas/core/categorical.py
Outdated
if self.is_dtype_equal(other): | ||
if self.categories.equals(other.categories): | ||
# fastpath to avoid re-coding | ||
return np.array_equal(self._codes, other._codes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could make this slightly simper
if self.categories.equals(....):
other_codes = other._codes
else:
other_codes = _recode......
return np.array_equal(self._codes, other_codes)
The original issue was already fixed. I added tests to verify (but no whatsnew entry). This addes tests and a fix for pandas-dev#16603 (comment) about `Categorical.equals` Closes pandas-dev#16603
0ff69a1
to
debae2b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a doc change, otherwise lgtm.
doc/source/whatsnew/v0.22.0.txt
Outdated
.. _whatsnew_0220: | ||
|
||
v0.22.0 | ||
------- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert this
@@ -365,7 +365,7 @@ Numeric | |||
Categorical | |||
^^^^^^^^^^^ | |||
|
|||
- | |||
- Bug in ``Categorical.equals`` between two unordered categories with the same categories, but in a different order (:issue:`16603`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use :func:
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't list all the Categorical
methods in the API docs, and .equals
is one of the excluded ones.
rebase and push again, fixed some hanging by Travis CI |
The original issue was already fixed. I added tests to verify (but no whatsnew entry).
This addes tests and a fix for #16603 (comment) about
Categorical.equals
Closes #16603